import java.math.BigInteger;

public class problem14 {
    public static int runSequence(int number) {
        BigInteger result = BigInteger.valueOf(number);
        int times = 1;

        do {
            if (result.mod(BigInteger.valueOf(2)).compareTo(BigInteger.ZERO) == 0) {
                result = result.divide(BigInteger.valueOf(2));
            } else {
                result = result.multiply(BigInteger.valueOf(3)).add(BigInteger.ONE);
            }
            times++;
        } while(result.compareTo(BigInteger.ONE) != 0);

        return times;
    }

    public static void main(String[] args) {
        int largestStartingNumber = 1;
        int largestTimes = 0;
        for (int i = 1; i < 1000000; i++) {
            int times = runSequence(i);
            System.out.println(i + " " + times);
            if (times > largestTimes) {
                largestTimes = times;
                largestStartingNumber = i;
            }
        }
        System.out.println(largestStartingNumber + " " + largestTimes);
    }
}
